package cn.le.beans.vo;

import com.github.pagehelper.Page;
import lombok.Data;

import java.util.List;

/**
 * @Description
 * @Author le
 * @Date 2020/2/28 11:34
 * @Version 0.1
 **/
@Data
public class PageVo<T> {

    private Integer pageNum;
    private Integer pageSize;
    private Integer totalPage;
    private Long total;
    private List<T> list;

    public static <T> PageVo<T> restPage(Page<T> pageInfo) {
        PageVo<T> result = new PageVo<T>();
        result.setTotalPage(pageInfo.getPages());
        result.setPageNum(pageInfo.getPageNum());
        result.setPageSize(pageInfo.getPageSize());
        result.setTotal(pageInfo.getTotal());
        result.setList(pageInfo.getResult());
        return result;
    }
}
